package com.cz.basetool.ui_work.util.data;

import java.util.Objects;

/**
 * Created by XinYi on 2019/3/14.
 * Three不够用，模仿的3参
 */

public class Three <F, S,T> {
public final F first;//是否成功
public final S second;//金额
public final T three;//查找的信息

/**
 * Constructor for a Three.
 *
 * @param first the first object in the Three
 * @param second the second object in the Three
 */
public Three(F first, S second,T three) {
        this.first = first;
        this.second = second;
        this.three = three;
}

/**
 * Checks the two objects for equality by delegating to their respective
 * {@link Object#equals(Object)} methods.
 *
 * @return true if the underlying objects of the Three are both considered
 *         equal
 */
@Override
public boolean equals(Object o) {
        if (!(o instanceof Three)) {
        return false;
        }
        Three<?, ?,?> p = (Three<?, ?,?>) o;
        return Objects.equals(p.first, first) && Objects.equals(p.second, second) && Objects.equals(p.three, three);
        }

/**
 * Compute a hash code using the hash codes of the underlying objects
 *
 * @return a hashcode of the Three
 */
@Override
public int hashCode() {
        return (first == null ? 0 : first.hashCode()) ^ (second == null ? 0 : second.hashCode())^ (three == null ? 0 : three.hashCode());
        }

/**
 * Convenience method for creating an appropriately typed Three.
 * @param a the first object in the Three
 * @param b the second object in the Three
 * @return a Three that is templatized with the types of a and b
 */
public static <A, B,C> Three <A, B,C> create(A a, B b,C c) {
        return new Three<A, B,C>(a, b,c);
        }
}
